In many data networks, there is a need to synchronize the clock signals of the network elements, so that the ratio of frequencies of the clock signals placed in two or more separate network elements is constant, as accurately as possible. Often the momentary steps of different clock signals are attempted to be kept equally large as accurately as possible. Said network elements can be for example routers or base stations of mobile phone networks. The synchronizing of clock signals is often based on that the network elements to be mutually synchronized transmit to each other synchronizing messages, on the basis of which each network element adjusts the operation frequency and/or phases of operation of its own clockwork. In many data networks, there is a remarkable random-type element in the transmission delays between the network elements, which random-type element complicates the adjusting process based on synchronizing messages and weakens the quality of the mutual synchronizing between the clock signals. Said random-type element is caused, among others, by random-type queuing delays experienced by the data to be transmitted in the transmission buffers and/or reception buffers of the network elements. The random-type nature of a transmission delay is strong particularly in packet, frame and cell switched data networks.